package com.saa.common.vo;

import java.io.Serializable;
import java.util.Map;

/**
 * 前后端交互实体
 */
public class OmsResultVo<T> implements Serializable {

    /**
     * 状态码
     */
    private Integer code;
    /**
     * 提示消息
     */
    private String msg;
    /**
     * 数据json
     */
    private T data;
    //条数
    private Integer count;
    /**
     * token
     */
    private String token;

    private Map returnMap;

    public static OmsResultVo builder(Integer code, String msg, Object data){
        OmsResultVo result = new OmsResultVo<>();
        result.setCode(code);
        result.setData(data);
        result.setMsg(msg);
        return result;
    }

    public static OmsResultVo builderPage(Integer code, String msg, Integer count,Object data){
        OmsResultVo result = new OmsResultVo<>();
        result.setCode(code);
        result.setData(data);
        result.setCount(count);
        result.setMsg(msg);
        return result;
    }
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "OmsResultVo{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public Integer getCount() {
        return count;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getToken() {
        return token;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Map getReturnMap() {
        return returnMap;
    }

    public void setReturnMap(Map returnMap) {
        this.returnMap = returnMap;
    }
}
